package com.isunland.managesystem.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BasePagerActivity;
import com.isunland.managesystem.entity.RequisitionSimpleOriginal;
import com.isunland.managesystem.utils.LogUtil;

/**
 * 对象功能: 加班申请pager
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: HuXiaoDan
 * 创建时间: 2017/2/7 10:33
 */
public class CheckOverPagerActivity extends BasePagerActivity
    implements CheckOverMainFragment.CallBack {

  private RequisitionSimpleOriginal content;
  private String ifAllowSupplement;

  @Override protected void onCreate(Bundle arg0) {
    content = (RequisitionSimpleOriginal) getIntent().getSerializableExtra(
        CheckOverMainFragment.EXTRA_CONTENT);
    ifAllowSupplement = getIntent().getStringExtra(CheckOverMainFragment.EXTRA_IFALLOWSUPPLEMENT);
    //content= (RequisitionSimpleOriginal) getIntent().getSerializableExtra(CheckOutMainFragment.EXTRA_CONTENT);
    //ifAllowSupplement=  getIntent().getStringExtra(CheckOutMainFragment.EXTRA_IFALLOWSUPPLEMENT);
    super.onCreate(arg0);
  }

  @Override protected Fragment createFragmentOne() {

    return CheckOverMainFragment.newInstance(content, CheckOverMainFragment.OVER,
        ifAllowSupplement);
    //return CheckOutMainFragment.newInstance(content,CheckOutMainFragment.OVER,ifAllowSupplement);
  }

  @Override protected Fragment createFragmentTwo() {

    if (content != null) {
      return CheckOverListFragment.newInstance(content.getId(), content.getDataStatus());
    } else {
      return CheckOverListFragment.newInstance("-1", "new");
    }
  }

  @Override protected int[] createTitle() {
    return new int[] { R.string.requisitionover, R.string.requisitionoverList };
  }

  @Override public void onRefresh(String pid) {
    LogUtil.i("添加保存id===" + pid);
    setNavigateTo(1);//跳转到第二个tab页
    CheckOverListFragment.updataId(pid);
  }

  //@Override public void onRefresh(String pid, String ifLaterWriter) {
  //  setNavigateTo(1);//跳转到第二个tab页
  //  CheckOverListFragment.updataId(pid);
  //}
}
